﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Dashboard.Services;
using Dashboard.Models;

namespace Dashboard.Controllers
{
    public class StatApiController : ApiController
    {
        private IStatDataRepository statRepo;

        public StatApiController()
        {
            this.statRepo = new StatDataRepository();
        }

        public int Get()
        {
            return statRepo.GetID();
        }

        public HttpResponseMessage Post(int ID, byte CPU, byte HDD, byte RAM)
        {
            this.statRepo.AddData(ID, CPU, HDD, RAM);

            var response = Request.CreateResponse<int>(System.Net.HttpStatusCode.Created, ID);

            return response;
        }

        public StatData Get(int id)
        {
            return statRepo.GetData(id);
        }
    }
}
